<?php
$this->breadcrumbs=array(
	'Distributor Products'=>array('index'),
	'Orders Manage',
);

$this->menu=array(
	array('label'=>'List Order', 'url'=>array('index')),
	array('label'=>'Create Order', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('order-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Orders</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'order-grid',
	'dataProvider'=>$model->search1(),
	'filter'=>$model,
	'columns'=>array(
		'order_id',
		array(
            'name'      => 'product_id',
            'value'     => 'Product::model()->findByPk($data->product_id)->name'
        ),
		'amount',
        'buying_price',
        'buy_tax',
        'shipping_price',
        'shipping_tax',
        'total_price',
        array(
            'name'      => 'status',
            'value'     => '$data->getStatusName()'
        ),
		/*
		'billing_address_id',
		'payment_method',
		'transporter_method',
		'amount',
		'shipping_price',
		'shipping_tax',
		'buying_price',
		'buy_tax',
		'total_price',
		'status',
		'created_time',
		'cancelled_time',
		'cancelled_by',
		'modified_time',
		'modified_by',
		'comment',
		*/
		array(
            'class'=>'CButtonColumn',
            'template'=>'{edit}{delete}',
            'buttons'=>array
            (
                'edit' => array
                (
                    'label'=>'edit',
                    'imageUrl'=>Yii::app()->request->baseUrl.'/images/edit_item.png',
                    'url'=>'Yii::app()->createUrl("distributor/product/orderView", array("id"=>$data->order_id))',
                ),
                'delete' => array
                (
                    'label'=>'delete',
                    'imageUrl'=>Yii::app()->request->baseUrl.'/images/delete_item.png',
                    'url'=>'Yii::app()->createUrl("distributor/product/orderDelete", array("id"=>$data->order_id))',
                ),
            ),
        ),
	),
)); ?>
